﻿package org.nickro.project
{
	import adobe.utils.CustomActions;
	import flash.display.*;
	import flash.events.*;
	import flash.net.*;
	import flash.text.*;
	import flash.utils.*;
	
	import org.nickro.project.Global;
	
	/**
	 * ...
	 * @author ...nickro
	 */
	public class LoadPrizeImg extends MovieClip
	{
		private var _uu:String;
		private var _ww:Number;
		private var _hh:Number;
		private var _loading:MovieClip;
		
		public function LoadPrizeImg(uu,ww,hh) 
		{
			_uu = uu;
			_ww = ww;
			_hh = hh;
			var _loader = new Loader();
			_loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, iPro);
			_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, iCom);
			
			_loader.load(new URLRequest(_uu));
		}
		private function iPro(evt:ProgressEvent) {
			_loading = new loading() as MovieClip;
			_loading.x =_ww / 2;
			_loading.y =_hh / 2;
			addChild(_loading);
		}
		private function  iCom(evt:Event) {			
			var _ct = evt.currentTarget.content;
			_ct.width = _ww;
			_ct.height = _hh;
			addChild(_ct);
			removeChild(_loading);
			
			Global._globalRoot.rootNUM++;
			trace("rootNUM:"+Global._globalRoot.rootNUM)
			if (Global._globalRoot.rootNUM >= 20) {
				if (Global._globalRoot.isfirst) {
					Global._globalRoot.isfirst = !Global._globalRoot.isfirst;
				}else {
					trace("GGGGGGGGGGGGGGG")
					Global._globalRoot.setTemNumFunc();
				}			
			}
		}
	}

}